package com.hyz.util;

import com.hyz.model.vo.AssetSecondmentResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import pojo.ResponseResult;
import pojo.asset.assetSecondment.AssetSecondment;

import java.util.List;

/**
 * @author HGD
 * @date 2022/10/9 19:25
 */
@Component
public class AssetSecondmentUtils {
    @Autowired
    private Conversion conversion;

    public ResponseResult<List<AssetSecondmentResponse>> getAssetSecondmentResponse(ResponseResult<List<AssetSecondment>> result) {
        int code = 200;
        if (result.getStatus() != code) {
            return new ResponseResult<>(result.getStatus(), result.getMsg());
        }
        List<AssetSecondmentResponse> response = conversion.getAssetSecondmentResponse(result.getData());
        return new ResponseResult<>(result.getStatus(), result.getMsg(), response);
    }
}
